package com.tastespot.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 369pro
 * @CreateTime: 2025-05-24
 * @Version: 1.0
 */
@Slf4j
@Configuration
public class RabbitMQConfig {
    private String secKillExchange = "seckill.exchange";
    private String secKillQueue = "seckill.orders.queue";
    private String secKillRoutingKey = "seckill.voucher";

    @Bean
    public Exchange secKillExchange() {
        return new TopicExchange(secKillExchange, true, false);
    }

    @Bean
    public Queue secKillQueue() {
        return new Queue(secKillQueue, true, false, false);
    }

    @Bean
    public Binding secKillBinding() {
        return new Binding(secKillQueue, Binding.DestinationType.QUEUE, secKillExchange, secKillRoutingKey, null);
    }
}
